package com.dudy;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by zhaojunwei on 16/11/20.
 */
@Component
public class TaskTest {

    /**
     * 1秒执行一次
     */
    @Scheduled(fixedRate = 1 * 1000)
    public void test() {
        System.out.println("this is a test!");
    }

    public static void main(String[] args) {
        ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("application-spring.xml");
        Object taskTest = classPathXmlApplicationContext.getBean("taskTest");
    }
}
